package com.woniu.exception.userexp;

import com.woniu.model.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class UserException {
    @ExceptionHandler(VenueRuntimeException.class)
    public Result<?> executorVenueException(VenueRuntimeException e){
        e.printStackTrace();
        return Result.getResult().setMsg(e.getMessage()).setCode(e.getCode());
    }

    @ExceptionHandler(YogaException.class)
    public Result<?> executorMovieException(YogaException e){
        e.printStackTrace();
        return Result.getResult().setMsg(e.getMessage()).setCode(e.getCode());
    }

    @ExceptionHandler(Throwable.class)
    public Result<?> executorThrowable(Throwable e){
        e.printStackTrace();
        return Result.getResult().setMsg(e.getMessage()).setCode(500);
    }
}
